package leetcode;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class AiQiYiMain {
    /**
     * 一个自然数数组arr，有大小为k的数据滑动窗口从数组头部往数组尾部滑动，
     * 窗口每次滑动一位，窗口最后一位到达数组末尾时滑动结束。
     * 窗口每次滑动后，窗口内k个整数的平均值相比滑动前会有一个变化幅度百分比p。
     */
    public static void main(String[] args) throws IOException {
        ArrayList<Integer> list = new ArrayList<>();
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s = br.readLine();
        int k = Integer.parseInt(s.substring(s.lastIndexOf(':') + 1));
        String numStr = s.substring(0, s.lastIndexOf(':'));
        String[] split = numStr.split(",");
        int[] ints = new int[split.length];
        for (int i = 0; i < split.length; i++) {
            ints[i] = Integer.parseInt(split[i]);
        }

        double maxRate = getMaxRate(ints, k);
        String s1 = Double.toString(maxRate);
        System.out.println(s1.substring(0,s1.lastIndexOf('.') + 3) + "%");
    }

    private static double getMaxRate(int[] nums, int k) {
        double maxRate = 0;
        double lastAvg;
        double sum = 0;
        for (int i = 0; i < k; i++) {
            sum += nums[i];
        }
        // 第一次的平均数
        lastAvg = sum / k;
        for (int i = 1, j = i + k; i < nums.length - k; i++, j++) {
            double avg = getRangeAvg(nums, i, j, k);
            maxRate = Math.max(maxRate, (avg - lastAvg) / lastAvg);
            lastAvg = avg;
        }
        return maxRate * 100;
    }
    private static double getRangeAvg(int[] nums, int left, int right,int k) {
        double sum = 0;
        for (int i = left; i < right; i++) {
            sum += nums[i];
        }
        return sum / k;
    }
}
